/**
 * Created by shen on 2017/11/20.
 */
// 登录用户信息
var userId = sessionStorage.getItem("userId");
var actorId = sessionStorage.getItem("actorId");
let userRealName = sessionStorage.getItem("userName");
$(document).ready(function () {
    if (typeof(userId) != "undefined" && userId != null) {
    } else {
        window.location.href = "http://localhost:8080/coolprint/system/logIns/logIn.html";
    }
    $("#userNamed").append("<span>" + userRealName + "</span>");
    $.getMenus();
});

$.getMenus = function (e) {
    $.ajax({
        url: "print_user/getMenus",
        type: "post",
        data: {
            actorId: actorId
        },
        dataType: "json",
        success: function (msg) {
            if (msg.ajaxInfo == "Success") {
                menuLen = msg.ajaxObject;
                $.createMenus(menuLen);
            }
        }
    })
};

$.createMenus = function (menuLen) {
    let amenu;
    let menurl;
    for (let i = 0; i < menuLen.length; i++) {
        if (menuLen[i].menuFather == 1) {
            amenu = "<li><a href='#' onclick=\"$(this).loadURL('" + menuLen[i].menuUrl + "')\">" + menuLen[i].menuIcon + menuLen[i].menuName + "</a></li>";
            $("#menus").append(amenu);
        }
    }

};